import 'package:gold/base/view_model.dart';
import 'package:gold/http/api_my.dart';
import 'package:gold/http/http.dart';

/// @description:
/// @author tangzhentao
/// @created at 22:57 2024/12/14


class InvoiceViewmodel extends Viewmodel {
  final List<String> list = ['111', '222', '333'];

  SortType? _sortType;
  /// 排序方式
  SortType? get sortType => _sortType;
  set sortType(SortType? value) {
    if (_sortType != value) {
      _sortType = value;
      load();
    }
  }

  /// 加载数据
  Future load() async {
    list.clear();
    setLoading();
    await Http().request<dynamic>(ApiMy.invoiceList);
    list.addAll(['111', '222', '333']);
    setSuccess();
  }
}

class SortType {
  final int type;
  final String asc;

  SortType(this.type, this.asc);
}